<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="zh">
    <head>
        <meta charset="UTF-8">
        <block name="title"><title>Jay's实验室</title></block>
        <link rel="stylesheet" type="text/css" href="__CSS__/basic.css">
        <link rel="stylesheet" type="text/css" href="__CSS__/style.css">
        <link rel="icon" href="__PUBLIC__/images/favicon.ico" type="img/x-icon"/>
        <block name="css"></block>
        <script type="text/javascript" src="__JS__/jquery.js"></script>
        <script type="text/javascript">
        (function(){
            var ThinkPHP = window.Think = {
                "ROOT"   : "__ROOT__", //当前网站地址
                "APP"    : "__APP__", //当前项目地址
                "PUBLIC" : "__PUBLIC__", //项目公共目录地址
                "DEEP"   : "{:C('URL_PATHINFO_DEPR')}", //PATHINFO分割符
                "MODEL"  : ["{:C('URL_MODEL')}", "{:C('URL_CASE_INSENSITIVE')}", "{:C('URL_HTML_SUFFIX')}"],
                "VAR"    : ["{:C('VAR_MODULE')}", "{:C('VAR_CONTROLLER')}", "{:C('VAR_ACTION')}"]
            }
        })();
        </script>
        <script type="text/javascript" src="__JS__/think.js"></script>
        <script type="text/javascript" src="__JS__/thinkbox/jquery.thinkbox.js"></script>
        <script type="text/javascript" src="__JS__/jquery.dragsort-0.5.1.min.js"></script>
        <script type="text/javascript">
            function showTab() {
                $(".tab-nav li").click(function() {
                    var self = $(this), target = self.data("tab");
                    self.addClass("current").siblings(".current").removeClass("current");
                    window.location.hash = "#" + target.substr(3);
                    $("tr[class*=tab]").hide()
                    $("tr." + target).show();
                }).filter("[data-tab=tab" + window.location.hash.substr(1) + "]").click();
                $('.tab-nav li.current').click();
            }

            /*获取复选框的值*/
            function getIdList() {
                var id = new Array();
                var i = 0;
                $(":checkbox[name='id[]']:checked").each(function() {
                    id[i] = $(this).val();
                    i++;
                });
                return id;
            }

            function highlight_sidebar(url) {
                $('#menuSub li a[href*="' + url + '"]').addClass('active').append('<span/>').parents('ul').removeAttr('style');
            }
            //ajax公共回调
            function defCallback(data, url) {
                var jump = url || '';
                if (data.status) {
                    $.thinkbox.success(data.info, {
                        afterShow: function() {
                            if (jump)
                                location.href = jump;
                        }
                    });
                } else {
                    $.thinkbox.error(data.info);
                }
            }

            //ajaxForm 公共函数
            function ajaxForm(element, callback, dataType) {
                var form = $(element).closest('form');
                var dataType = dataType || 'json';
                $.ajax({
                    type: "POST",
                    url: form.attr('action'),
                    data: form.serialize(),
                    async: false,
                    dataType: dataType,
                    success: function(data) {
                        if ($.isFunction(callback)) {
                            callback(data, form);
                        }
                    }
                });
            }
        </script>
    <block name="js"></block>
</head>
<body>
    <div id="header">
        <div id="logo">
            <a href="">
                <img src="__IMG__/logo_2.png" alt="">
            </a>
        </div>
        <div id="login">
            <i id="headerPerson" class="headerSetting">
                <div id="popCont">
                    <p>您好，<span>{:get_admin_name()}</span>
                    </p>
                    <ul>
                        <li>
                            <a href="{:U('System/logout')}">退出登录</a>
                        </li>
                    </ul>
                    <i class="ib"></i>
                </div>
            </i>
        </div>
    </div>
    <div id="publicCommon">
        <div id="sidebar">
            <div id="menuSub">
                <a href="{:U('System/index')}" id="index">首页</a>
                <h3><i></i>文章</h3>
                <ul>
                    <li>
                        <a href="{:U('Article/index')}">文章列表</a>
                    </li>
                    <li>
                        <a href="{:U('Cate/index')}">分类列表</a>
                    </li>
                </ul>
                <ul>
                    <li><a href="{:U('Attach/index')}">附件列表</a></li>
                </ul>
                <h3><i></i>扩展</h3>
                <ul>
                    <li><a href="{:U('Addons/index')}">插件列表</a></li>
                    <li><a href="{:U('Addons/hooks')}">钩子列表</a></li>
                </ul>
                <h3><i></i>配置</h3>
                <ul>
                    <li><a href="{:U('Config/group?id=1')}">网站设置</a></li>
                    <li><a href="{:U('Config/index')}">配置列表</a></li>
                </ul>
                <h3><i></i>用户</h3>
                <ul>
                    <li><a href="{:U('User/index')}">用户列表</a></li>
                </ul>
            </div>
            <div class="stretch_l">
                <span></span>
            </div>
        </div>
        <div id="main">
            <div class="stretch_r">
                <span></span>
            </div>
            <block name="content">

            </block>
            <present name="page"> {$page}</present>
        </div>
    </div>
    <script type="text/javascript">
        var public_path = '__PUBLIC__';
        var current_url = '__SELF__'.split('?')[0];
        var host = '{$_SERVER['HTTP_HOST']}';
        //input 和textarea 只读和禁用时 退格在ie下会自动后退的bug
        document.documentElement.onkeydown = function(evt) {
            var b = !!evt, oEvent = evt || window.event;
            if (oEvent.keyCode == 8) {
                var node = b ? oEvent.target : oEvent.srcElement;
                var reg = /^(input|textarea)$/i, regType = /^(text|textarea)$/i;
                if (!reg.test(node.nodeName) || !regType.test(node.type) || node.readOnly || node.disabled) {
                    if (b) {
                        oEvent.stopPropagation();
                    } else {
                        oEvent.cancelBubble = true;
                        oEvent.keyCode = 0;
                        oEvent.returnValue = false;
                    }
                }
            }
        }

        $(function() {
            //sidebar 列表收起
            $("#menuSub ul").hide();
            $("#menuSub h3").toggle(function() {
                $(this).next("ul").stop(true, true).slideDown("normal");
            }, function() {
                $(this).next("ul").stop(true, true).slideUp("normal");
            });

            //sidebar 箭头
            $(".stretch_l").hover(function() {
                $(this).children("span").addClass("arrow_l_hover");
            }, function() {
                $(this).children("span").removeClass("arrow_l_hover");
            });

            $(".stretch_r").hover(function() {
                $(this).children("span").addClass("arrow_r_hover");
            }, function() {
                $(this).children("span").removeClass("arrow_r_hover");
            });

            //sideBar高亮
            if (current_url != '/' && current_url != '{:U(' / ')}' && current_url != '{:rtrim(U(' / '), ' / ')}')
                $('#menuSub li a[href*="' + current_url + '"]').addClass('active').append('<span/>').parents('ul').show();

            //sidebar 收起
            $(".stretch_l").click(function() {
                $("#sidebar").css({'margin-left': '-200px'});
                $("#main").css({'margin-left': '0'});
                $("#publicCommon").css("background", "none");
                $(".stretch_r").show();
                $(".content").css("margin-left", "20px");
                $(this).hide();
            });
            $(".stretch_r").click(function() {
                $(this).hide();
                $(".stretch_l").show();
                $("#sidebar").css({'margin-left': '0px'});
                $("#main").css({'margin-left': '204px'});
                $(".content").css("margin-left", "0px");
            });

            //登录用户退出
            $("#headerPerson").bind('click', function() {
                if ($("#popCont").is(":hidden")) {
                    $("#popCont").show();
                } else {
                    $("#popCont").hide();
                }
            })
            $("#popCont").mouseleave(function() {
                $(this).hide();
            })

            //排序按钮
            $("#sortButton").live("click", function() {
                var id = getIdList();
                if (id.length < 2) {
                    $.thinkbox.error("您至少要选择2条数据！");
                    return false;
                }
                var url = $(this).data("operate");
                url = url + id.join(",");
                var pop = $.thinkbox.load(url, {
                    title: "拖动数据排序",
                    onload: function(data) {
                        $data = $(data);
                        $("#sortUl", $data).dragsort({
                            dragSelector: 'li',
                            dragEnd: function() {
                                $("#hidden").attr("value", "");
                                $(".getSort").each(function() {
                                    if ($("#hidden").attr("value") == "") {
                                        $("#hidden").attr("value", $(this).attr("value"));
                                    }
                                    else {
                                        $("#hidden").attr("value", $("#hidden").attr("value") + ',' + $(this).attr("value"));
                                    }

                                })

                            }
                        });
                        return $data;
                    }
                });
            });
        });
        <block name="foot_js">
        </block>
    </script>
</body>
</html>
